/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.productSpec.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.productSpec.domain.ProductSpec;
import com.seeyoui.kensite.bussiness.orderlang.productSpec.persistence.ProductSpecMapper;

/**
 * ProductSpec
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-02-07
 */

@Service
public class ProductSpecService extends BaseService {
	
	@Autowired
	private ProductSpecMapper productSpecMapper;
	
	public List<ProductSpec> findListByProductPriceId(String productPriceId){
		return productSpecMapper.findListByProductPriceId(productPriceId);
	}
	
	public List<ProductSpec> findListByProductId(String productId){
		return productSpecMapper.findListByProductId(productId);
	}
	

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public ProductSpec findOne(String id) throws CRUDException{
		return productSpecMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param productSpec
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductSpec> findList(ProductSpec productSpec) throws CRUDException {
		return productSpecMapper.findList(productSpec);
	}
	
	/**
	 * 查询所有数据集合
	 * @param productSpec
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductSpec> findAll(ProductSpec productSpec) throws CRUDException {
		return productSpecMapper.findAll(productSpec);
	}
	
	/**
	 * 查询数据总数
	 * @param productSpec
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(ProductSpec productSpec) throws CRUDException {
		return productSpecMapper.findTotal(productSpec);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param productSpec
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(ProductSpec productSpec) throws CRUDException {
		return productSpecMapper.findExTotal(productSpec);
	}
	
	/**
	 * 数据新增
	 * @param productSpec
	 * @throws CRUDException
	 */
	public void save(ProductSpec productSpec) throws CRUDException{
		productSpec.preInsert();
		productSpecMapper.save(productSpec);
	}
	
	/**
	 * 数据修改
	 * @param productSpec
	 * @throws CRUDException
	 */
	public void update(ProductSpec productSpec) throws CRUDException{
		productSpec.preUpdate();
		productSpecMapper.update(productSpec);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		productSpecMapper.delete(listId);
	}
	
	public void deleteByPriceId(List<String> priceId) throws CRUDException {
		productSpecMapper.deleteByPriceId(priceId);
	}
	
	/**
	 * 数据假删除
	 * @param productSpec
	 * @throws CRUDException
	 */
	public void remove(ProductSpec productSpec) throws CRUDException{
		productSpec.preUpdate();
		productSpecMapper.remove(productSpec);			
	}
	
}